package com.ftd.utils;

import com.ftd.dao.BorrowDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimerTask;

@ContextConfiguration(value = {"classpath:WEB-INF/spring-dao.xml"})
public class UpdateLeftDayTimerTask extends TimerTask {
    private static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    @Autowired
    private BorrowDao borrowDao;
    @Override
    public void run() {
        try {
            System.out.println("执行当前时间"+formatter.format(Calendar.getInstance().getTime()));
            borrowDao.autoUpdate();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}